{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox-title">
        <h5>生成账号</h5>
    </div>
    <div class="ibox-content layui-form">
        <div class="layui-row layui-col-space10 layui-form-item ">
            <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                    <label class="layui-form-label">数量：</label>
                    <div class="layui-input-block">
                        <input type="text" name="number" lay-verify="required" class="layui-input" placeholder="账号数量" oninput="value=value.replace(/[^\d]/g,'')"  maxlength="3">
                    </div>
                </div>
                <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                    <label class="layui-form-label">代理：</label>
                    <div class="layui-input-block">
                        <select name="area" lay-verify="required" lay-search="">
                            <option value="">请选择代理</option>
                            {if !empty($area)}
                            {foreach name="area" item="vo"}
                            <option value="{$vo.area}" >{$vo.username}</option>
                            {/foreach}
                            {/if}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                        </button>
                        <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
    {include file="public/footer" /}
    <script>
        layui.use(['form'], function() {
            var form = layui.form;
            form.on('submit(component-form-element)', function (data) {
                $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
                $.ajax({
                    url:"{:url('createAccount')}",
                    type:'post',
                    dataType:'json',
                    data:data.field,
                    success:function(res){
                        if (res.code == 200) {
                            wk.success(res.msg,"{:url('partner/index')}")
                        } else {
                            wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                        }
                    }
                })
            });
        });
    </script>
</body>
</html>